colorchooserwidgeet: Reset the selected swatch when removing
authorTimm Bäder <mail@baedert.org>
Sat, 30 Jan 2016 21:31:27 +0000 (22:31 +0100)
committerTimm Bäder <mail@baedert.org>
Sat, 30 Jan 2016 22:02:06 +0000 (23:02 +0100)
Otherwise, priv->current points to garbage and subsequently leads to a
crash, e.g. when adding another custom color.

gtk/gtkcolorchooserwidget.c

index 4986065d4d466fc81c53149c1d23c2c028101b84..c51144c1f76310a91a02e7be44ee68ed557d16ed 100644 (file)
@@ -747,6 +747,9 @@ add_custom_color (GtkColorChooserWidget *cc,
   if (g_list_length (children) >= 9)
     {
       last = g_list_last (children)->data;
+      if (last == GTK_WIDGET (cc->priv->current))
+        cc->priv->current = NULL;
+
       gtk_widget_destroy (last);
     }